﻿using System.Linq;
using System.Web.Mvc;
using XRM.Security.DataAccess.Helpers;
using XRM.Security.WebUI.Models.Home;

namespace XRM.Security.WebUI.Controllers
{
    [Authorize]
    public class HomeController : BaseController
    {
        public ActionResult Index()
        {
            var model = new MainPageModel
                {
                    OpenRequestCount = RequestRepository.GetAll().OpenRequests().Count(),
                    ExpiredCertificateCount = CertRegisterRepository.GetAll().ExpiredCertificates( DataModelUtils.SoonExpireDaysCount ).Count()
                };
            return View(model);
        }
    }
}
